<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <title>论坛筛选 - 社交圈</title>
  <!-- Bootstrap 5 CSS -->
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css">
  
  <style>
    :root {
      --primary: #5B7BDF;
      --primary-light: #E8EBFA;
      --secondary: #FF7D54;
      --success: #4CAF50;
      --warning: #FFC107;
      --danger: #F44336;
      --text-primary: #1D2129;
      --text-secondary: #86909C;
      --bg-light: #F2F3F5;
      --bg-white: #FFFFFF;
      --border-light: #E5E6EB;
    }
    
    body {
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
      background-color: var(--bg-light);
      color: var(--text-primary);
      line-height: 1.6;
      font-size: 15px;
      padding-bottom: 60px;
    }
    
    /* 顶部导航 */
    .navbar {
      background-color: var(--primary);
      color: white;
      padding: 0.75rem 1rem;
    }
    
    .navbar-nav .nav-link {
      color: rgba(255, 255, 255, 0.9);
      padding: 0.5rem 0.75rem;
    }
    
    .navbar-nav .nav-link.active {
      color: white;
      font-weight: 500;
    }
    
    /* 搜索栏 */
    .search-container {
      padding: 12px 15px;
      background-color: var(--bg-white);
      border-bottom: 1px solid var(--border-light);
    }
    
    .search-box {
      position: relative;
    }
    
    .search-input {
      width: 100%;
      padding: 10px 15px 10px 40px;
      border-radius: 8px;
      border: 1px solid var(--border-light);
      font-size: 14px;
      background-color: var(--bg-light);
    }
    
    .search-input:focus {
      outline: none;
      border-color: var(--primary);
    }
    
    .search-icon {
      position: absolute;
      left: 12px;
      top: 50%;
      transform: translateY(-50%);
      color: var(--text-secondary);
    }
    
    /* 筛选工具栏 */
    .filter-toolbar {
      background-color: var(--bg-white);
      padding: 10px 15px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-bottom: 1px solid var(--border-light);
    }
    
    .filter-btn {
      display: flex;
      align-items: center;
      gap: 5px;
      color: var(--text-primary);
      background: none;
      border: none;
      padding: 5px 10px;
      border-radius: 6px;
      font-size: 14px;
    }
    
    .filter-btn.active {
      background-color: var(--primary-light);
      color: var(--primary);
    }
    
    .view-style {
      display: flex;
      gap: 8px;
    }
    
    .view-btn {
      width: 32px;
      height: 32px;
      border-radius: 6px;
      border: 1px solid var(--border-light);
      background-color: var(--bg-white);
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--text-secondary);
    }
    
    .view-btn.active {
      background-color: var(--primary);
      color: white;
      border-color: var(--primary);
    }
    
    /* 筛选面板 */
    .filter-panel {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background-color: rgba(0, 0, 0, 0.5);
      z-index: 1050;
      display: none;
      justify-content: flex-end;
    }
    
    .filter-panel.show {
      display: flex;
    }
    
    .filter-content {
      width: 85%;
      max-width: 350px;
      background-color: var(--bg-white);
      height: 100%;
      overflow-y: auto;
      transform: translateX(100%);
      transition: transform 0.3s ease;
    }
    
    .filter-panel.show .filter-content {
      transform: translateX(0);
    }
    
    .filter-header {
      padding: 15px;
      border-bottom: 1px solid var(--border-light);
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    
    .filter-title {
      font-size: 18px;
      font-weight: 600;
    }
    
    .close-filter {
      background: none;
      border: none;
      font-size: 20px;
      color: var(--text-secondary);
    }
    
    .filter-section {
      padding: 15px;
      border-bottom: 1px solid var(--border-light);
    }
    
    .filter-section-title {
      font-size: 16px;
      font-weight: 600;
      margin-bottom: 12px;
    }
    
    /* 分类筛选 */
    .category-filter {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
    }
    
    .category-tag {
      padding: 6px 12px;
      border-radius: 20px;
      font-size: 14px;
      background-color: var(--bg-light);
      color: var(--text-primary);
      cursor: pointer;
    }
    
    .category-tag.active {
      background-color: var(--primary);
      color: white;
    }
    
    /* 时间筛选 */
    .time-filter {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    
    .time-option {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 8px 0;
    }
    
    .time-option input {
      width: 18px;
      height: 18px;
      accent-color: var(--primary);
    }
    
    /* 排序筛选 */
    .sort-filter {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    
    .sort-option {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 8px 0;
    }
    
    .sort-option-label {
      display: flex;
      align-items: center;
      gap: 10px;
    }
    
    .sort-option input {
      width: 18px;
      height: 18px;
      accent-color: var(--primary);
    }
    
    /* 筛选按钮组 */
    .filter-actions {
      padding: 15px;
      display: flex;
      gap: 10px;
    }
    
    .filter-action-btn {
      flex: 1;
      padding: 10px 0;
      border-radius: 8px;
      font-size: 15px;
      font-weight: 500;
      border: none;
    }
    
    .reset-btn {
      background-color: var(--bg-light);
      color: var(--text-secondary);
    }
    
    .confirm-btn {
      background-color: var(--primary);
      color: white;
    }
    
    /* 筛选结果标签 */
    .filter-tags {
      padding: 10px 15px;
      background-color: var(--bg-white);
      border-bottom: 1px solid var(--border-light);
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      align-items: center;
    }
    
    .active-filter-tag {
      display: flex;
      align-items: center;
      gap: 5px;
      padding: 4px 10px;
      background-color: var(--primary-light);
      color: var(--primary);
      border-radius: 16px;
      font-size: 13px;
    }
    
    .remove-tag {
      width: 16px;
      height: 16px;
      border-radius: 50%;
      background-color: rgba(91, 123, 223, 0.2);
      color: var(--primary);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 10px;
      cursor: pointer;
    }
    
    .clear-all {
      color: var(--text-secondary);
      font-size: 13px;
      cursor: pointer;
      margin-left: auto;
    }
    
    /* 论坛内容容器 */
    .forum-container {
      display: none;
    }
    
    .forum-container.active {
      display: block;
    }
    
    /* 列表式展示 */
    .list-forum .topic-list {
      background-color: var(--bg-white);
      margin: 0;
      border-radius: 0;
    }
    
    .list-forum .topic-item {
      border-bottom: 1px solid var(--border-light);
      padding: 12px 15px;
    }
    
    /* 卡片式展示 */
    .card-forum .topic-list {
      padding: 10px 15px;
      background-color: transparent;
    }
    
    .card-forum .topic-item {
      background-color: var(--bg-white);
      border-radius: 12px;
      margin-bottom: 10px;
      box-shadow: 0 2px 5px rgba(0,0,0,0.03);
    }
    
    /* 紧凑式展示 */
    .compact-forum .topic-item {
      padding: 8px 15px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      background-color: var(--bg-white);
      border-bottom: 1px solid var(--border-light);
    }
    
    .compact-forum .topic-title {
      margin: 0;
      font-size: 14px;
      flex: 1;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      padding-right: 10px;
    }
    
    .compact-forum .topic-meta {
      display: none;
    }
    
    .compact-forum .topic-header {
      display: none;
    }
    
    .compact-forum .topic-actions {
      gap: 10px;
    }
    
    /* 话题样式通用 */
    .topic-list {
      margin: 0;
    }
    
    .topic-item {
      padding: 15px;
    }
    
    .topic-header {
      display: flex;
      justify-content: space-between;
      margin-bottom: 8px;
    }
    
    .topic-category {
      display: inline-block;
      padding: 3px 8px;
      background-color: var(--primary-light);
      color: var(--primary);
      border-radius: 4px;
      font-size: 12px;
      font-weight: 500;
    }
    
    .topic-time {
      font-size: 12px;
      color: var(--text-secondary);
    }
    
    .topic-title {
      font-size: 16px;
      font-weight: 500;
      margin-bottom: 10px;
      line-height: 1.4;
    }
    
    .topic-meta {
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    
    .topic-author {
      display: flex;
      align-items: center;
    }
    
    .author-avatar {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      object-fit: cover;
      margin-right: 8px;
    }
    
    .author-name {
      font-size: 13px;
    }
    
    .topic-actions {
      display: flex;
      gap: 15px;
      font-size: 13px;
      color: var(--text-secondary);
    }
    
    .action-item {
      display: flex;
      align-items: center;
      gap: 4px;
    }
    
    .hot-tag {
      display: inline-block;
      background-color: var(--danger);
      color: white;
      width: 16px;
      height: 16px;
      border-radius: 3px;
      font-size: 10px;
      text-align: center;
      line-height: 16px;
      margin-left: 5px;
    }
    
    /* 底部导航 */
    .bottom-nav {
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      background-color: var(--bg-white);
      border-top: 1px solid var(--border-light);
      display: flex;
      justify-content: space-around;
      padding: 8px 0;
      z-index: 1000;
    }
    
    .nav-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      color: var(--text-secondary);
      text-decoration: none;
      font-size: 10px;
      flex: 1;
    }
    
    .nav-item.active {
      color: var(--primary);
    }
    
    .nav-icon {
      font-size: 20px;
      margin-bottom: 3px;
    }
    
    /* 发布按钮 */
    .fab-button {
      position: fixed;
      bottom: 70px;
      right: 20px;
      width: 50px;
      height: 50px;
      border-radius: 50%;
      background-color: var(--secondary);
      color: white;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 22px;
      box-shadow: 0 4px 10px rgba(255, 125, 84, 0.4);
      border: none;
      z-index: 1000;
    }
    
    /* 无结果状态 */
    .no-results {
      padding: 60px 20px;
      text-align: center;
      color: var(--text-secondary);
    }
    
    .no-results i {
      font-size: 48px;
      margin-bottom: 15px;
      color: var(--border-light);
    }
  </style>
</head>
<body>
  <!-- 顶部导航 -->
  <nav class="navbar navbar-expand">
    <div class="container-fluid">
      <ul class="navbar-nav w-100 justify-content-between">
        <li class="nav-item">
          <a class="nav-link" href="#" aria-label="返回">
            <i class="fa fa-arrow-left"></i>
          </a>
        </li>
        <li class="nav-item">
          <a class="nav-link active" href="#">论坛筛选</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="#" aria-label="通知">
            <i class="fa fa-bell-o"></i>
          </a>
        </li>
      </ul>
    </div>
  </nav>
  
  <!-- 搜索栏 -->
  <div class="search-container">
    <div class="search-box">
      <i class="fa fa-search search-icon"></i>
      <input type="text" class="search-input" placeholder="搜索话题、内容或用户...">
    </div>
  </div>
  
  <!-- 筛选工具栏 -->
  <div class="filter-toolbar">
    <button class="filter-btn active" id="categoryFilterBtn">
      <i class="fa fa-th-large"></i> 分类
    </button>
    <button class="filter-btn" id="timeFilterBtn">
      <i class="fa fa-clock-o"></i> 时间
    </button>
    <button class="filter-btn" id="sortFilterBtn">
      <i class="fa fa-sort"></i> 排序
    </button>
    <div class="view-style">
      <button class="view-btn active" data-view="list" title="列表视图">
        <i class="fa fa-list"></i>
      </button>
      <button class="view-btn" data-view="card" title="卡片视图">
        <i class="fa fa-th-large"></i>
      </button>
      <button class="view-btn" data-view="compact" title="紧凑视图">
        <i class="fa fa-align-left"></i>
      </button>
    </div>
  </div>
  
  <!-- 筛选结果标签 -->
  <div class="filter-tags">
    <div class="active-filter-tag">
      <span>技术交流</span>
      <span class="remove-tag" data-type="category">×</span>
    </div>
    <div class="active-filter-tag">
      <span>近一周</span>
      <span class="remove-tag" data-type="time">×</span>
    </div>
    <div class="active-filter-tag">
      <span>热门优先</span>
      <span class="remove-tag" data-type="sort">×</span>
    </div>
    <div class="clear-all">清除全部</div>
  </div>
  
  <!-- 论坛内容容器 -->
  <div class="forum-container active list-forum" id="forumContent">
    <div class="topic-list">
      <div class="topic-item">
        <div class="topic-header">
          <span class="topic-category">技术交流</span>
          <span class="topic-time">2小时前</span>
        </div>
        <div class="topic-title">
          React 18新特性详解及实战案例 <span class="hot-tag">热</span>
        </div>
        <div class="topic-meta">
          <div class="topic-author">
            <img src="https://picsum.photos/200/200?random=1" alt="作者头像" class="author-avatar">
            <span class="author-name">李思成</span>
          </div>
          <div class="topic-actions">
            <div class="action-item">
              <i class="fa fa-eye"></i> 2.1k
            </div>
            <div class="action-item">
              <i class="fa fa-comment-o"></i> 86
            </div>
            <div class="action-item">
              <i class="fa fa-heart-o"></i> 324
            </div>
          </div>
        </div>
      </div>
      
      <div class="topic-item">
        <div class="topic-header">
          <span class="topic-category">技术交流</span>
          <span class="topic-time">昨天 15:30</span>
        </div>
        <div class="topic-title">
          前端性能优化的10个实用技巧
        </div>
        <div class="topic-meta">
          <div class="topic-author">
            <img src="https://picsum.photos/200/200?random=2" alt="作者头像" class="author-avatar">
            <span class="author-name">张开发</span>
          </div>
          <div class="topic-actions">
            <div class="action-item">
              <i class="fa fa-eye"></i> 1.8k
            </div>
            <div class="action-item">
              <i class="fa fa-comment-o"></i> 52
            </div>
            <div class="action-item">
              <i class="fa fa-heart-o"></i> 198
            </div>
          </div>
        </div>
      </div>
      
      <div class="topic-item">
        <div class="topic-header">
          <span class="topic-category">技术交流</span>
          <span class="topic-time">3天前</span>
        </div>
        <div class="topic-title">
          TypeScript高级类型技巧分享
        </div>
        <div class="topic-meta">
          <div class="topic-author">
            <img src="https://picsum.photos/200/200?random=3" alt="作者头像" class="author-avatar">
            <span class="author-name">王程序</span>
          </div>
          <div class="topic-actions">
            <div class="action-item">
              <i class="fa fa-eye"></i> 1.5k
            </div>
            <div class="action-item">
              <i class="fa fa-comment-o"></i> 47
            </div>
            <div class="action-item">
              <i class="fa fa-heart-o"></i> 215
            </div>
          </div>
        </div>
      </div>
      
      <div class="topic-item">
        <div class="topic-header">
          <span class="topic-category">技术交流</span>
          <span class="topic-time">5天前</span>
        </div>
        <div class="topic-title">
          从零开始搭建Node.js后端服务
        </div>
        <div class="topic-meta">
          <div class="topic-author">
            <img src="https://picsum.photos/200/200?random=4" alt="作者头像" class="author-avatar">
            <span class="author-name">赵后端</span>
          </div>
          <div class="topic-actions">
            <div class="action-item">
              <i class="fa fa-eye"></i> 1.2k
            </div>
            <div class="action-item">
              <i class="fa fa-comment-o"></i> 36
            </div>
            <div class="action-item">
              <i class="fa fa-heart-o"></i> 156
            </div>
          </div>
        </div>
      </div>
      
      <div class="topic-item">
        <div class="topic-header">
          <span class="topic-category">技术交流</span>
          <span class="topic-time">6天前</span>
        </div>
        <div class="topic-title">
          微前端架构实践与踩坑记录
        </div>
        <div class="topic-meta">
          <div class="topic-author">
            <img src="https://picsum.photos/200/200?random=5" alt="作者头像" class="author-avatar">
            <span class="author-name">陈架构</span>
          </div>
          <div class="topic-actions">
            <div class="action-item">
              <i class="fa fa-eye"></i> 986
            </div>
            <div class="action-item">
              <i class="fa fa-comment-o"></i> 28
            </div>
            <div class="action-item">
              <i class="fa fa-heart-o"></i> 124
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  
  <!-- 无结果状态 (默认隐藏) -->
  <div class="no-results" style="display: none;">
    <i class="fa fa-search"></i>
    <div>没有找到符合条件的内容</div>
    <div style="margin-top: 10px; font-size: 14px;">尝试调整筛选条件或搜索关键词</div>
  </div>
  
  <!-- 分类筛选面板 -->
  <div class="filter-panel" id="categoryFilter">
    <div class="filter-content">
      <div class="filter-header">
        <div class="filter-title">选择分类</div>
        <button class="close-filter">&times;</button>
      </div>
      <div class="filter-section">
        <div class="filter-section-title">论坛分类</div>
        <div class="category-filter">
          <div class="category-tag active">全部</div>
          <div class="category-tag active">技术交流</div>
          <div class="category-tag">产品设计</div>
          <div class="category-tag">设计创意</div>
          <div class="category-tag">摄影爱好者</div>
          <div class="category-tag">阅读与分享</div>
          <div class="category-tag">美食探店</div>
          <div class="category-tag">职场交流</div>
          <div class="category-tag">学习与成长</div>
        </div>
      </div>
      <div class="filter-actions">
        <button class="filter-action-btn reset-btn">重置</button>
        <button class="filter-action-btn confirm-btn">确认</button>
      </div>
    </div>
  </div>
  
  <!-- 时间筛选面板 -->
  <div class="filter-panel" id="timeFilter">
    <div class="filter-content">
      <div class="filter-header">
        <div class="filter-title">选择时间</div>
        <button class="close-filter">&times;</button>
      </div>
      <div class="filter-section">
        <div class="filter-section-title">发布时间</div>
        <div class="time-filter">
          <div class="time-option">
            <input type="radio" name="time" id="time-all">
            <label for="time-all">全部时间</label>
          </div>
          <div class="time-option">
            <input type="radio" name="time" id="time-today" checked>
            <label for="time-today">今天</label>
          </div>
          <div class="time-option">
            <input type="radio" name="time" id="time-week">
            <label for="time-week">近一周</label>
          </div>
          <div class="time-option">
            <input type="radio" name="time" id="time-month">
            <label for="time-month">近一个月</label>
          </div>
          <div class="time-option">
            <input type="radio" name="time" id="time-quarter">
            <label for="time-quarter">近三个月</label>
          </div>
          <div class="time-option">
            <input type="radio" name="time" id="time-year">
            <label for="time-year">近一年</label>
          </div>
        </div>
      </div>
      <div class="filter-actions">
        <button class="filter-action-btn reset-btn">重置</button>
        <button class="filter-action-btn confirm-btn">确认</button>
      </div>
    </div>
  </div>
  
  <!-- 排序筛选面板 -->
  <div class="filter-panel" id="sortFilter">
    <div class="filter-content">
      <div class="filter-header">
        <div class="filter-title">排序方式</div>
        <button class="close-filter">&times;</button>
      </div>
      <div class="filter-section">
        <div class="filter-section-title">结果排序</div>
        <div class="sort-filter">
          <div class="sort-option">
            <div class="sort-option-label">
              <input type="radio" name="sort" id="sort-hot" checked>
              <label for="sort-hot">热门优先</label>
            </div>
            <i class="fa fa-check text-primary" style="display: block;"></i>
          </div>
          <div class="sort-option">
            <div class="sort-option-label">
              <input type="radio" name="sort" id="sort-new">
              <label for="sort-new">最新发布</label>
            </div>
            <i class="fa fa-check text-primary" style="display: none;"></i>
          </div>
          <div class="sort-option">
            <div class="sort-option-label">
              <input type="radio" name="sort" id="sort-reply">
              <label for="sort-reply">回复最多</label>
            </div>
            <i class="fa fa-check text-primary" style="display: none;"></i>
          </div>
          <div class="sort-option">
            <div class="sort-option-label">
              <input type="radio" name="sort" id="sort-view">
              <label for="sort-view">浏览最多</label>
            </div>
            <i class="fa fa-check text-primary" style="display: none;"></i>
          </div>
          <div class="sort-option">
            <div class="sort-option-label">
              <input type="radio" name="sort" id="sort-favorite">
              <label for="sort-favorite">点赞最多</label>
            </div>
            <i class="fa fa-check text-primary" style="display: none;"></i>
          </div>
        </div>
      </div>
      <div class="filter-actions">
        <button class="filter-action-btn reset-btn">重置</button>
        <button class="filter-action-btn confirm-btn">确认</button>
      </div>
    </div>
  </div>
  
  <!-- 底部导航 -->
  <div class="bottom-nav">
    <a href="#" class="nav-item">
      <i class="fa fa-home nav-icon"></i>
      <span>首页</span>
    </a>
    <a href="#" class="nav-item active">
      <i class="fa fa-comments nav-icon"></i>
      <span>论坛</span>
    </a>
    <a href="#" class="nav-item">
      <i class="fa fa-user nav-icon"></i>
      <span>我的</span>
    </a>
  </div>
  
  <!-- 发布按钮 -->
  <button class="fab-button" aria-label="发布新帖">
    <i class="fa fa-plus"></i>
  </button>
  
  <!-- Bootstrap JS -->
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
  
  <script>
    // 获取DOM元素
    const categoryFilterBtn = document.getElementById('categoryFilterBtn');
    const timeFilterBtn = document.getElementById('timeFilterBtn');
    const sortFilterBtn = document.getElementById('sortFilterBtn');
    const categoryFilter = document.getElementById('categoryFilter');
    const timeFilter = document.getElementById('timeFilter');
    const sortFilter = document.getElementById('sortFilter');
    const closeButtons = document.querySelectorAll('.close-filter');
    const confirmButtons = document.querySelectorAll('.confirm-btn');
    const resetButtons = document.querySelectorAll('.reset-btn');
    const viewButtons = document.querySelectorAll('.view-btn');
    const forumContent = document.getElementById('forumContent');
    const categoryTags = document.querySelectorAll('.category-tag');
    const sortOptions = document.querySelectorAll('.sort-option');
    const filterTags = document.querySelector('.filter-tags');
    const removeTags = document.querySelectorAll('.remove-tag');
    const clearAll = document.querySelector('.clear-all');
    const searchInput = document.querySelector('.search-input');
    
    // 打开筛选面板
    function openFilter(panel) {
      // 关闭所有面板
      document.querySelectorAll('.filter-panel').forEach(p => p.classList.remove('show'));
      // 打开目标面板
      panel.classList.add('show');
      // 阻止背景滚动
      document.body.style.overflow = 'hidden';
    }
    
    // 关闭筛选面板
    function closeAllFilters() {
      document.querySelectorAll('.filter-panel').forEach(panel => {
        panel.classList.remove('show');
      });
      // 恢复背景滚动
      document.body.style.overflow = '';
    }
    
    // 筛选按钮点击事件
    categoryFilterBtn.addEventListener('click', () => openFilter(categoryFilter));
    timeFilterBtn.addEventListener('click', () => openFilter(timeFilter));
    sortFilterBtn.addEventListener('click', () => openFilter(sortFilter));
    
    // 关闭按钮点击事件
    closeButtons.forEach(btn => {
      btn.addEventListener('click', closeAllFilters);
    });
    
    // 点击面板外部关闭
    document.querySelectorAll('.filter-panel').forEach(panel => {
      panel.addEventListener('click', (e) => {
        if (e.target === panel) {
          closeAllFilters();
        }
      });
    });
    
    // 确认按钮点击事件
    confirmButtons.forEach(btn => {
      btn.addEventListener('click', () => {
        closeAllFilters();
        // 这里可以添加筛选逻辑
        updateFilterTags();
      });
    });
    
    // 重置按钮点击事件
    resetButtons.forEach(btn => {
      btn.addEventListener('click', () => {
        const panel = btn.closest('.filter-panel');
        
        // 重置分类筛选
        if (panel.id === 'categoryFilter') {
          categoryTags.forEach(tag => tag.classList.remove('active'));
          categoryTags[0].classList.add('active'); // 选中"全部"
        }
        // 重置时间筛选
        else if (panel.id === 'timeFilter') {
          document.querySelectorAll('input[name="time"]').forEach(radio => {
            radio.checked = false;
          });
          document.getElementById('time-all').checked = true;
        }
        // 重置排序筛选
        else if (panel.id === 'sortFilter') {
          document.querySelectorAll('input[name="sort"]').forEach(radio => {
            radio.checked = false;
          });
          document.getElementById('sort-hot').checked = true;
          updateSortIcons();
        }
      });
    });
    
    // 更新排序选项图标
    function updateSortIcons() {
      const checkedRadio = document.querySelector('input[name="sort"]:checked');
      sortOptions.forEach(option => {
        const radio = option.querySelector('input[name="sort"]');
        const icon = option.querySelector('.fa-check');
        icon.style.display = radio === checkedRadio ? 'block' : 'none';
      });
    }
    
    // 排序选项点击事件
    sortOptions.forEach(option => {
      option.addEventListener('click', () => {
        const radio = option.querySelector('input[name="sort"]');
        radio.checked = true;
        updateSortIcons();
      });
    });
    
    // 分类标签点击事件
    categoryTags.forEach(tag => {
      tag.addEventListener('click', () => {
        // 如果点击的是"全部"，取消其他选中状态
        if (tag.textContent === '全部') {
          categoryTags.forEach(t => t.classList.remove('active'));
          tag.classList.add('active');
        } else {
          // 取消"全部"的选中状态
          categoryTags[0].classList.remove('active');
          // 切换当前标签的选中状态
          tag.classList.toggle('active');
        }
      });
    });
    
    // 视图切换按钮点击事件
    viewButtons.forEach(btn => {
      btn.addEventListener('click', () => {
        // 移除所有按钮的活跃状态
        viewButtons.forEach(b => b.classList.remove('active'));
        // 添加当前按钮的活跃状态
        btn.classList.add('active');
        
        // 移除所有视图类
        forumContent.classList.remove('list-forum', 'card-forum', 'compact-forum');
        // 添加当前视图类
        forumContent.classList.add(`${btn.getAttribute('data-view')}-forum`);
      });
    });
    
    // 更新筛选标签
    function updateFilterTags() {
      // 这里只是模拟更新，实际应用中应根据实际筛选条件更新
      console.log('筛选条件已更新');
    }
    
    // 移除单个筛选标签
    removeTags.forEach(tag => {
      tag.addEventListener('click', () => {
        const tagElement = tag.parentElement;
        tagElement.remove();
        
        // 如果没有筛选标签了，隐藏整个标签容器
        if (filterTags.children.length <= 1) {
          filterTags.style.display = 'none';
        }
      });
    });
    
    // 清除所有筛选条件
    clearAll.addEventListener('click', () => {
      // 移除所有筛选标签
      const tags = document.querySelectorAll('.active-filter-tag');
      tags.forEach(tag => tag.remove());
      
      // 隐藏标签容器
      filterTags.style.display = 'none';
      
      // 重置所有筛选条件
      categoryTags.forEach(tag => tag.classList.remove('active'));
      categoryTags[0].classList.add('active');
      
      document.querySelectorAll('input[name="time"]').forEach(radio => {
        radio.checked = false;
      });
      document.getElementById('time-all').checked = true;
      
      document.querySelectorAll('input[name="sort"]').forEach(radio => {
        radio.checked = false;
      });
      document.getElementById('sort-hot').checked = true;
      updateSortIcons();
    });
    
    // 搜索输入事件
    searchInput.addEventListener('input', (e) => {
      const searchTerm = e.target.value.trim();
      // 这里可以添加搜索逻辑
      console.log('搜索:', searchTerm);
    });
    
    // 话题项点击事件
    document.querySelectorAll('.topic-item').forEach(item => {
      item.addEventListener('click', () => {
        const title = item.querySelector('.topic-title').textContent.trim();
        alert(`查看话题: ${title}`);
      });
    });
    
    // 发布按钮点击事件
    document.querySelector('.fab-button').addEventListener('click', () => {
      alert('打开发布新帖窗口');
    });
  </script>
</body>
</html>
